<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <link rel="stylesheet" type="text/css" href="static/css/default.css" media="all" />
        <link rel="stylesheet" type="text/css" href="static/css/layout.css" media="all" />
        <link rel="stylesheet" type="text/css" href="static/css/general.css"/>
        <link rel="stylesheet" type="text/css" href="static/css/jquery.theme.css" media="all" />
        <link rel="stylesheet" type="text/css" href="static/css/jquery.core.css" media="all" />
        <link rel="stylesheet" type="text/css" href="static/css/jquery.ui.datepicker.css" media="all" />

        <link rel="stylesheet" type="text/css" href="static/css/jquery.ui.button.css" media="all" />
        <link rel="stylesheet" type="text/css" href="static/css/jquery.ui.resizable.css" media="all" />
        <link rel="stylesheet" type="text/css" href="static/css/jquery.ui.dialog.css" media="all" />
        <link rel="stylesheet" type="text/css" href="static/css/jquery.ui.tooltip.css" media="all" />
        <link rel="stylesheet" type="text/css" href="static/css/jquery.ui.tooltip.css" media="all" />
        <link rel="stylesheet" type="text/css" href="static/css/jquery.ui.menu.css" media="all" />
        <link rel="stylesheet" type="text/css" href="static/css/jquery.ui.override.css" media="all" />
        <link rel="stylesheet" type="text/css" href="static/css/list_favorite.css" media="all" />

        <link rel="stylesheet" type="text/css" href="static/css/user-own.css" media="all" />
        <link rel="stylesheet" type="text/css" href="static/css/profile.css" media="all" />
        <script type='text/javascript' src='static/js/jquery.min.js'></script>
        <script type='text/javascript' src='static/js/menu.js'></script>
        <script type='text/javascript' src='static/js/jquery.ui.core.js'></script>
        <script type='text/javascript' src='static/js/jquery.ui.widget.js'></script>
        <script type='text/javascript' src='static/js/jquery.ui.datepicker.js'></script>

        <script type='text/javascript' src='static/js/jquery.ui.button.js'></script>
        <script type='text/javascript' src='static/js/jquery.ui.draggable.js'></script>
        <script type='text/javascript' src='static/js/jquery.ui.mouse.js'></script>
        <script type='text/javascript' src='static/js/jquery.ui.position.js'></script>
        <script type='text/javascript' src='static/js/jquery.ui.resizable.js'></script>
        <script type='text/javascript' src='static/js/jquery.ui.dialog.js'></script>
        <script type='text/javascript' src='static/js/jquery.ui.tooltip.js'></script>
        <script type='text/javascript' src='static/js/jquery.ui.menu.js'></script>

        <script type='text/javascript' src='static/js/general.js'></script>
        <script type='text/javascript' src='static/js/profile.js'></script>
        <script type='text/javascript'>
            $(document).ready(function(){
                $('.remove').click(function(event){
                    event.preventDefault();

                    if($(this).hasClass('finish')){
                        return;
                    }
                    $confirm = window.confirm('Are you sure?');
                    if($confirm == true){
                        $id = $(this).attr('id').replace('remove_','');

                        var $option = {
                            url: 'index.php?c=index&m=removefavoriteuser',
                            type: 'POST',
                            data:'favorite[id]=' + $id + '&favorite[isAjax]=' + 1,
                            dataType:'text',
                            success: function($reponse){
                                $response = eval('(' + $reponse + ')');
                                if($response.result == 1){
                                    $('#remove_' + $response.id).removeClass('remove').addClass('finish');
                                    $('#remove_' + $response.id).html('Removed');
                                }
                                else{
                                    alert("Can't remove memmber from favorite.");
                                }
                            },
                            error: function(){
                            }
                        };
                        $.ajax($option);
                    }
                });
            });
        </script>
        <script type="text/javascript" src="static/js/tiny_mce/tiny_mce.js" ></script>
        <script type="text/javascript" >
            
            tinyMCE.init({
                mode : "textareas",
                theme : "simple",
                elements: 'product_description',
                theme : "advanced",
                theme_advanced_buttons1 : "mylistbox,mysplitbutton,bold,italic,underline,separator,strikethrough,justifyleft,justifycenter,justifyright,justifyfull,bullist,numlist,undo,redo,link,unlink",
                theme_advanced_buttons2 : "",
                theme_advanced_buttons3 : "",
                theme_advanced_toolbar_location : "top",
                theme_advanced_toolbar_align : "left",
                theme_advanced_statusbar_location : "bottom",
                width:"480",
                height:"300"
            });
        </script>

    </head>
    <body>
        <div class="body">
            <div class="header">
                <div class="float-left text-left login">
                    <span>Welcome lampart.com.</span>
                    <a id="signin" class="sign-in" href="index.php?c=logout">Sign out</a>
                    <?php if ($this->userLog->level == 1): ?> |
                        <a id="admin_panel" class="sign-in" href="index.php?c=adminIndex&m=index">Admin panel</a>
                    <?php endif; ?>
                </div>

            </div>
            <div class="search">
                <div class="social-connect"></div>
                <div class="logo">
                    <a href="#" title="">Lampart.com</a>
                </div>
                <div class="search-control">
                    <form action="index.php?c=search" method="get" id="search_control">
                        <div class="search-category">
                            <div id="search_title" class="search-title">
                                <span id="search_category_title" style="font-size: 10px;">All  </span>
                                <img src="images/arrow_down.png" />
                            </div>
                            <ul id="search_menu" class="search-menu">
                                <li id="0" class="menu-option">All</li>
                                <li id="1" class="menu-option">Male</li>
                                <li id="2" class="menu-option">Female</li>
                            </ul>
                        </div>
                        <input type="hidden" id="search_controller" value="search" name="c" />
                        <input type="hidden" id="search_sex" value="" name="search[sex]" />
                        <input type="text" name="search[name]" size="15" />
                        <input type="submit" id="search" name="search[search]" value="Search" />
                    </form>
                </div>
            </div>
            <div class="content">
                <div class="left">
                    <div class='header'>My profile</div>
                    <div class="main">
                        <div class="image">
                            <img width='150px' height='150px' src="<?php echo!empty($this->userLog->picture) ? 'img/' . $this->userLog->picture : 'img/0.gif'; ?>"/>
                        </div>
                        <table>
                            <tr><td class="profile_head">Fullname:</td><td class="profile_detail"><?php echo $this->userLog->name; ?></td></tr>
                            <tr><td class="profile_head">Username:</td><td class="profile_detail"><?php echo $this->userLog->username; ?></td></tr>
                            <tr><td class="profile_head">Email:</td><td class="profile_detail"><?php echo $this->userLog->email; ?></td></tr>
                            <tr><td class="profile_head">Permission:</td><td class="profile_detail"><?php echo ($this->userLog->level == 1) ? 'Administator' : 'Member'; ?></td></tr>
                            <tr><td class="profile_head">Address:</td><td class="profile_detail"><?php echo $this->userLog->address; ?></td></tr>
                            <tr><td class="profile_head">Sex:</td><td class="profile_detail"><?php echo $this->userLog->sex == 1 ? 'Male' : 'Female'; ?></td></tr>
                            <tr><td class="profile_head">Birthday:</td><td class="profile_detail"><?php echo date('d-m-Y', $this->userLog->birthday); ?></td></tr>
                        </table>
                    </div>
                    <div class="control">
                        <a href="index.php">List subject</a><br />
                        <a href="index.php?c=profile">Update profile</a><br />
                        <a href="index.php?c=profile&m=addavatar">Update avatar</a>
                    </div>
                    <div></div>
                </div>
                <div class="main-content">
                    <div class="profile">
                        <h2><span class="header-page">Add subject</span></h2>
                        <br />
                        <form action='index.php?c=addsubject<?php echo!empty($this->_get['id']) ? "&id=" . $this->_get['id'] : ''; ?>' method='post' name='add_subject' id='add_subject'>
                            <table>
                                <tr>
                                    <td colspan='2'><span class='error'><?php echo!empty($this->error) ? $this->error : ''; ?></span></td>
                                </tr>
                                <tr>
                                    <td colspan='2'><input type='hidden' value='<?php echo!empty($this->_get['id']) ? $this->_get['id'] : ''; ?>' name='user[id]' id='id' /></td>
                                </tr>
                                <tr>
                                    <td>
                                        <span>Name:</span><br />
                                        <input type='text' size='20' name='subject[name]' id='name' value='<?php echo isset($this->_post['subject']['name']) ? $this->_post['subject']['name'] : $this->subjectEdit->name; ?>' />
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        <span>Content:</span><br />
                                        <textarea name="subject[content]" id='subject' cols="10" rows="5" >
                                            <?php echo isset($this->_post['subject']['content']) ? $this->_post['subject']['content'] : $this->subjectEdit->content; ?>
                                        </textarea>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        <input type='hidden' name='user[token]' id='token' value='<?php ?>' />
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        <input type='submit' name='submit' id='submit' value='Add subject' />
                                    </td>
                                </tr>
                            </table>
                        </form>
                    </div>

                </div>
                <div class="right">

                </div>
            </div>
            <div class="clear-fix"></div>
            <div class="footer text-center">
                <a href="#">About</a><span class="separator">|</span>
                <a href="#">Privacy</a><span class="separator">|</span>
                <a href="#">Terms</a><span class="separator">|</span>
                <a href="#">Feedback</a><span class="separator">|</span>
                <a href="#">Copyright</a>
                <br />
            </div>
        </div>
    </body>
</html>